﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _6.SumOFMaxK
{
    class SumOfMaxK
    {
        static void Main(string[] args)
        {
            Console.WriteLine("n=");
            int n = int.Parse(Console.ReadLine());
            Console.WriteLine("k=");
            int k = int.Parse(Console.ReadLine());

            int[] arrayN;
            arrayN = new int[n];
            for (int i = 0; i < arrayN.Length; i++)
            {
                Console.WriteLine("arrayN[" + i + "]=");
                arrayN[i] = int.Parse(Console.ReadLine());
            }
            int currentSum = 0;
            int bestSum = int.MinValue;
            for (int i = 0; i < arrayN.Length; i++)
            {
                if (i + k > arrayN.Length)
                {
                    break;
                }
                for (int j = i; j < i + k; j++)
                {
                    currentSum = currentSum + arrayN[j];
                }
                if (currentSum > bestSum)
                {
                    bestSum = currentSum;
                }
                currentSum = 0;
            }
            Console.WriteLine(bestSum);
        }
    }
}